import Vue from 'vue'
import Vuex from 'vuex'
import axios from 'axios'

Vue.prototype.$axios=axios
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    list:[]
  },
  mutations: {
    shoplist(state,item){
      state.list=item
    }
  },
  actions: {
    shoplist(context){
      axios.get("http://localhost:8080/shoplist.json")
      .then(res=>{
        console.log(res.data)
        context.commit('shoplist',res.data)
      })
    }
  },
  modules: {
  }
})
